home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / wheels1.arc / DISKTYP.LIB < prev    next >
Text File  |  1985-06-28  |  2KB  |  50 lines

  1. {@@@@@@@@@@@ copyright (C) 1984 by Neil J. Rubenking @@@@@@@@@@@@@@@@@@@@@@@@
  2. The purchaser of these procedures and functions may include them in COMPILED
  3. programs freely, but may not sell or give away the source text.
  4.  
  5. The parameter to function DiskType is the drive letter, or '@' for the default
  6. drive.  The output is the number of K the disk is formatted for
  7.   (360, 320, 180, 160) or one of two error numbers:
  8.  
  9.   error 0 indicates an invalid drive number
  10.   error 1 indicates a non-standard format
  11.  
  12.      NOTE that any file that INCLUDES this file must also INCLUDE
  13.      the type definitions in REGPACK.TYP}
  14.  
  15. {@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}
  16.  
  17.  
  18. function DiskType(which : char):integer;
  19.  
  20. var
  21.   regs : regpack;
  22. begin
  23.   with regs do
  24.     begin
  25.       DX := ord(UpCase(which)) - 64;   { This gives 1 for A, 2 for B,
  26.                                          &c.  Since @ is the ASCII char
  27.                                          just before A, @ gives 0, which
  28.                                          is the code for the default drive.}
  29.       AX := $36 shl 8;
  30.       MSDOS(regs);        { call DOS function $36 }
  31.       if AX = $FFFF then
  32.         DiskType := 0
  33.       else
  34.         begin
  35.           case DX of
  36.             $162: DiskType := 360;  { See the DOS 2.0 manual, Appendix D }
  37.             $15F: DiskType := 180;
  38.             $13B: DiskType := 320;
  39.             $139: DiskType := 160;
  40.           else DiskType := 1;
  41.           end; {case}
  42.         end;
  43.     end; {with}
  44. end;
  45.  
  46.  
  47.  
  48.  
  49.  
  50.